package 笔试题;

import java.util.*;

public class lk_1146 {


}
//超内存，需要只记录每个数据修改的版本和值
class SnapshotArray{
    private List<int[]> host = new ArrayList<>();
    private int[] d;
    private int k = 0;
    public SnapshotArray(int length) {
        d = new int[length];
    }

    public void set(int index, int val) {
        d[index] = val;
    }

    public int snap() {
        int[] a = new int[d.length];
        a = Arrays.copyOf(d,0);
        host.add(a);
        return k++;
    }

    public int get(int index, int snap_id) {
        return host.get(snap_id)[index];
    }
}
